package com.alumni_circle.core.entity;

import com.alumni_circle.core.constant.ResponseCode;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * @author 龙斌
 * @since 2020-07-03 12:12
 *
 * 基于BaseResponseModel，返回List集合对象
 */
@EqualsAndHashCode(callSuper = true)
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResponseListModel<T> extends BaseResponseModel {
    /**
     * 数据
     */
    private List<T> datalist;

    private String total;

    public ResponseListModel() {
        super(ResponseCode.SUCCESS.getCode(), ResponseCode.SUCCESS.getMessage());
    }

    public ResponseListModel(List<T> datalist) {
        super(ResponseCode.SUCCESS.getCode(), ResponseCode.SUCCESS.getMessage());
        this.datalist = datalist;
    }

    public ResponseListModel(int code, String message) {
        super(code, message);
    }

    public ResponseListModel(List<T> datalist, int code, String message) {
        super(code, message);
        this.datalist = datalist;
    }

    public ResponseListModel(List<T> datalist,String total){
        super(ResponseCode.SUCCESS.getCode(), ResponseCode.SUCCESS.getMessage());
        this.datalist = datalist;
        this.total = total;
    }

}
